package com.ruoyi.system.controller;


import com.ruoyi.system.domain.dto.TrainingMealStatisticDTO;
import com.ruoyi.system.service.ITrainingMealStatisticService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/training-meal-statistic")
public class TrainingMealStatisticController {

    @Autowired
    private ITrainingMealStatisticService itrainingMealStatisticService;

    @GetMapping("/by-month")
    public List<TrainingMealStatisticDTO> getTrainingMealStatisticsByMonth(
            @RequestParam @DateTimeFormat(pattern = "yyyy-MM") String month) {
        return itrainingMealStatisticService.getTrainingMealStatisticsByMonth(month);
    }
}